<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<html>
<head>
    <meta charset="UTF-8">
    <title>合同归档</title>
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <link rel="stylesheet" href="css/bootstrap-3.3.7/css/bootstrap.min.css" />
    <link rel="stylesheet" href="css/register.css" />
    <link rel="stylesheet" href="css/newListcommon.css" />
    <link rel="stylesheet" href="css/maintenanceForm.css" />
</head>
<style>
    .addMaintenanceForm .addNewmetail{
        margin-left:0;
    }
    .addMaintenanceForm .addNewmetail{
        color:#fff !important
    }
    .form-control[disabled], .form-control[readonly], fieldset[disabled] .form-control{
        background-color: #fff !important;
    }
    .form-group select, .form-group input{
        width: calc(100vw / 2 - 300px);
    }
    input[type=radio]{
        width:20px;
    }
    .addMaintenanceForm .col-md-12 .fuyan {
        width: calc(100vw - 380px);
        margin-left: 13px;
    }
    .purchaseModal .modal-dialog{
        max-width:1000px !important;
        width:1000px;
    }
    .purchaseModal .modal-dialog button{
        height:30px;
    }
    .cancelBtn{
        display: inline-block;background: #e36858;color:#fff !important;width: 120px;height: 40px;text-align: center;line-height: 40px;font-weight: 400;border-radius: 2px;text-decoration: none;
    }
</style>
<%-- 导入面包屑 --%>
<jsp:include page="../common/nav.jsp"></jsp:include>
<body class="addMaintenance">
<div class="purchaseOrder addMaintenanceForm">
    <div class="formTitle">合同基本信息</div>
    <div class="trackInfomation">
        <fieldset id="myFieldset">
            <input id="poHeadId" name="poHeadId" type="hidden" value="${requestScope.poHead.poHeadId}">
            <div class="row">
                <div class="col-md-6">
                    <div class="form-group">
                        <span>*</span>
                        <label>合同名称：</label>
                        <input id="poName" name="poName" type="text" class="form-control" placeholder="合同名称" value="${requestScope.poHead.poName}">
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <span>*</span>
                        <label>合同编码：</label>
                        <input id="poHeadCode" name="poHeadCode" type="text" class="form-control" placeholder="合同编码" value="${requestScope.poHead.poHeadCode}" readonly>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <span>*</span>
                        <label>合同单号：</label>
                        <input id="projectCode" name="projectCode" type="text" class="form-control" placeholder="合同单号" value="${requestScope.poHead.projectCode}" readonly>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <span>*</span>
                        <label>签订单位：</label>
                        <input id="vendorCode" name="vendorCode" type="text" class="form-control" placeholder="请选择签订单位"  data-toggle="modal"  value="${requestScope.poHead.vendorCode}">
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <span>*</span>
                        <label>发起单位：</label>
                        <input id="sponsorCode" name="sponsorCode" type="text" class="form-control" placeholder="请选择发起单位" data-toggle="modal" value="${requestScope.poHead.sponsorCode}">
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <span>*</span>
                        <label>合同性质：</label>
                        <select class="form-control" name="taxType" id="taxType">
                            <option>请选择合同性质</option>
                            <c:forEach items="${requestScope.poQualeMap}" var="taxType">
                                <option value="${taxType.key}">${taxType.value}</option>
                            </c:forEach>
                        </select>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <span>*</span>
                        <label>合同类别：</label>
                        <select class="form-control" name="taxPercent" id="taxPercent">
                            <option>请选择合同类别</option>
                            <c:forEach items="${requestScope.poCateMap}" var="taxPercent">
                                <option value="${taxPercent.key}">${taxPercent.value}</option>
                            </c:forEach>
                        </select>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <span>*</span>
                        <label>合同类型：</label>
                        <select class="form-control" name="poType" id="poType" onchange="funcPoTypeChange()">
                            <option>请选择合同类型</option>
                            <c:forEach items="${requestScope.poTypeMap}" var="poType">
                                <option value="${poType.key}">${poType.value}</option>
                            </c:forEach>
                        </select>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <span>*</span>
                        <label>实施站点：</label>
                        <input id="orgCode" name="orgCode" type="text" class="form-control" placeholder="请选择实施站点" data-toggle="modal" value="${requestScope.poHead.orgCode}">
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <span>*</span>
                        <label>实施部门：</label>
                        <input id="departmentCode" name="departmentCode" type="text" class="form-control" placeholder="请选择实施部门" data-toggle="modal" value="${requestScope.poHead.departmentCode}">
                    </div>
                </div>
                <div class="col-md-12">
                    <div class="form-group">
                        <span></span>
                        <label class="fuyanText">使用方向：</label>
                        <textarea style="height:80px !important;" id="poDesc" name="poDesc" class="form-control fuyan" rows="3">${requestScope.poHead.poDesc}</textarea>
                    </div>
                </div>
                <div class="col-md-12">
                   <div class="form-group">
                       <span></span>
                        <label class="fuyanText">上传附件：</label>
                        <%--<div class="upload-wrap fuyanFile" id="uploadImgBtn0">
                            <input type="file" multiple="multiple" name="files" id="file0"/>
                            <input id="fileUrl" name="fileUrl" type="hidden"  value="${requestScope.poHead.fileUrl}">
                        </div>--%>
                    </div>
                    <div id="showFile" style="margin-left:136px;"></div>
                </div>
            </div>
            <div class="formTitle">合同详细信息</div>
            <div class="trackInfomation">
                <div class="row">
                    <div class="col-md-6">
                        <div class="form-group">
                            <span>*</span>
                            <label>结算方式：</label>
                            <select class="form-control" name="settleStyle" id="settleStyle">
                                <option>请选择结算方式</option>
                                <c:forEach items="${requestScope.poSettleMap}" var="settleStyle">
                                    <option value="${settleStyle.key}">${settleStyle.value}</option>
                                </c:forEach>
                            </select>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <span>*</span>
                            <label>实施地点：</label>
                            <input id="constructionSite" name="constructionSite" type="text" class="form-control" placeholder="实施地点" value="${requestScope.poHead.constructionSite}">
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <span>*</span>
                            <label>合同来源方式：</label>
                            <select class="form-control" name="sourceMode" id="sourceMode">
                                <option>请选择合同来源方式</option>
                                <c:forEach items="${requestScope.poSourceMap}" var="sourceMode">
                                    <option value="${sourceMode.key}">${sourceMode.value}</option>
                                </c:forEach>
                            </select>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <span>*</span>
                            <label>审批表档案号：</label>
                            <input id="approvalFileNo" name="approvalFileNo" type="text" class="form-control" placeholder="审批表档案号" value="${requestScope.poHead.approvalFileNo}">
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <span>*</span>
                            <label>补充描述：</label>
                            <input id="addDesc" name="addDesc" type="text" class="form-control" placeholder="补充描述" value="${requestScope.poHead.addDesc}">
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <span>*</span>
                            <label>签订日期：</label>
                            <input id="startDate" name="startDate" type="text" class="form-control" placeholder="签订日期" value="${requestScope.poHead.startDate}">
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <span>*</span>
                            <label>终止日期：</label>
                            <input id="endDate" name="endDate" type="text" class="form-control" placeholder="终止日期" value="${requestScope.poHead.endDate}">
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <span>*</span>
                            <label>是否为据实结算：</label>
                            <input id="isRealSettle" name="isRealSettle" type="checkbox" class="form-check-input" value="是">
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <span>&nbsp;</span>
                            <label>合同金额：</label>
                            <input id="poaAmount" name="poaAmount" type="text" class="form-control" placeholder="合同金额" value="${requestScope.poHead.poaAmount}">
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <span>*</span>
                            <label>货币：</label>
                            <select class="form-control" name="currencyCode" id="currencyCode">
                                <option>请选择货币</option>
                                <c:forEach items="${requestScope.currencyTypeMap}" var="currencyType">
                                    <option value="${currencyType.key}" <c:if test="${currencyType.key=='rmb'}"> selected="selected" </c:if>>
                                            ${currencyType.value}
                                    </option>
                                </c:forEach>
                            </select>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <span>&nbsp;</span>
                            <label>质保金额：</label>
                            <input id="warrantyAmount" name="warrantyAmount" type="text" class="form-control" placeholder="质保金额" value="${requestScope.poHead.warrantyAmount}">
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <span>&nbsp;</span>
                            <label>质保期限：</label>
                            <input id="warrantyPeriod" name="warrantyPeriod" type="text" class="form-control" placeholder="质保期限" value="${requestScope.poHead.warrantyPeriod}">
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <span>*</span>
                            <label>合同预估金额：</label>
                            <input id="prepayAmount" name="prepayAmount" type="text" class="form-control" placeholder="合同预估金额" value="${requestScope.poHead.prepayAmount}">
                        </div>
                    </div>
                </div>
            </div>
            <div class="formTitle">供应商信息</div>
            <div class="trackInfomation">
                <div class="row">
                    <div class="col-md-6">
                        <div class="form-group">
                            <span>*</span>
                            <label>公司名称：</label>
                            <select class="form-control" name="staffCode" id="staffCode" onchange="funcVendorSelect()">
                                <option>请选择公司名称</option>
                                <c:forEach items="${requestScope.vendorMap}" var="staffCode">
                                    <option value="${staffCode.key}">${staffCode.value}</option>
                                </c:forEach>
                            </select>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <span>&nbsp;</span>
                            <label>公司地址：</label>
                            <input readonly="readonly" type="text" class="form-control" placeholder="公司地址" id="vendorAddress">
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <span>&nbsp;</span>
                            <label>公司传真：</label>
                            <input readonly="readonly" type="text" class="form-control" placeholder="公司传真" id="email">
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <span>&nbsp;</span>
                            <label>所属省份：</label>
                            <input readonly="readonly" type="text" class="form-control" placeholder="所属省份" id="vendorProvince">
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <span>&nbsp;</span>
                            <label>市、州：</label>
                            <input readonly="readonly" type="text" class="form-control" placeholder="市、州" id="vendorCity">
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <span>&nbsp;</span>
                            <label>邮政编码：</label>
                            <input readonly="readonly" type="text" class="form-control" placeholder="邮政编码" id="youzhengbianma">
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <span>&nbsp;</span>
                            <label>客户联系人：</label>
                            <input readonly="readonly" type="text" class="form-control" placeholder="客户联系人" id="contactName">
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <span>&nbsp;</span>
                            <label>联系电话：</label>
                            <input readonly="readonly" type="text" class="form-control" placeholder="联系电话" id="contactTelephone">
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <span>&nbsp;</span>
                            <label>收款单位：</label>
                            <input readonly="readonly" type="text" class="form-control" placeholder="收款单位" id="staffName">
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <span>&nbsp;</span>
                            <label>开户银行：</label>
                            <input readonly="readonly" type="text" class="form-control" placeholder="开户银行" id="bankCode">
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <span>&nbsp;</span>
                            <label>银行账号：</label>
                            <input readonly="readonly" type="text" class="form-control" placeholder="银行账号" id="bankAccount">
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="form-group">
                            <span></span>
                            <label class="fuyanText">收付款方式：</label>
                            <textarea style="height:80px !important;" id="paymentMethod" name="paymentMethod" class="form-control fuyan" rows="3">${requestScope.poHead.paymentMethod}</textarea>
                        </div>
                    </div>
                </div>
            </div>
            <div class="formTitle">合同谈判参与人员</div>
            <div class="trackInfomation">
                <div class="row">
                    <div class="col-md-12">
                        <div class="form-group">
                            <span>&nbsp;</span>
                            <label>姓名：</label>
                            <input  type="text" class="form-control" placeholder="支持输入多人，中间用顿号进行间隔" value="${requestScope.poHead.poParticipants}">
                        </div>
                    </div>
                </div>
            </div>
            <div class="formTitle">
                付款状况
            </div>
            <div class="tableWrap">
                <table class="table table-bordered" id="subBody">
                    <thead >
                    <tr>
                        <th width="5%">序号</th>
                        <th>支付批次</th>
                        <th>支付金额</th>
                        <th>支付比例</th>
                        <th>剩余金额</th>
                        <th>支付时间</th>
                        <th>备注</th>
                    </tr>
                    </thead>
                </table>
            </div>
        </fieldset>
        <!--历史审批记录-->
        <div class="formTitle">历史审批记录</div>
        <div class="tableWrap">
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th>序号</th>
                    <th>操作人</th>
                    <th>所属公司</th>
                    <th>部门</th>
                    <th>结果</th>
                    <th>审批意见</th>
                    <th>操作时间</th>
                </tr>
                </thead>
                <c:if test="${empty requestScope.subTaskInfoList}">
                    <tr id="nothing">
                        <td colspan="8" style="color: #bbbbbb">无审批信息</td>
                    </tr>
                </c:if>
                <c:if test="${not empty requestScope.subTaskInfoList}">
                    <c:forEach items="${requestScope.subTaskInfoList}" var="sub" varStatus="index">
                        <tr >
                            <td>${index.count}</td>
                            <td>${sub.staff_name}</td>
                            <td>${sub.company_name}</td>
                            <td>${sub.department_name}</td>
                            <c:if test="${sub.status=='0'}">
                                <td>驳回</td>
                            </c:if>
                            <c:if test="${sub.status=='1'}">
                                <td>同意</td>
                            </c:if>

                            <td>${sub.proc_contents}</td>
                            <td>${sub.proc_time}</td>
                        </tr>
                    </c:forEach>
                </c:if>
            </table>
        </div>
        <!--历史审批记录-->
        <form id="form" action="web/poAgreementHeadArchived/editPoHeadArchived" method="post">
        <div class="formTitle">合同归档</div>
        <div class="trackInfomation">
            <input name="poHeadId" type="hidden" value="${requestScope.poHead.poHeadId}">
            <input name="poHeadCode" type="hidden" value="${requestScope.poHead.poHeadCode}">
            <div class="row">
                <div class="col-md-6">
                    <div class="form-group">
                        <span>&nbsp;</span>
                        <label>归档人：</label>
                        <input readonly="readonly" type="text" class="form-control" placeholder="归档人" id="archivedBy" name="archivedBy" value="${requestScope.poHead.archivedBy}">
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <span>&nbsp;</span>
                        <label>归档部门：</label>
                        <input readonly="readonly" type="text" class="form-control" placeholder="归档部门" id="archivedDepart" name="archivedDepart" value="${requestScope.poHead.archivedDepart}">
                    </div>
                </div>
                <div class="col-md-12">
                    <div class="form-group">
                        <span></span>
                        <label class="fuyanText">相关附件：</label>
                        <%--<div class="upload-wrap fuyanFile" style="width: calc(100vw - 320px);position: relative;left:0;" id="uploadImgBtn1">
                            <input style="width:180px;" type="file" multiple="multiple" name="files" id="file1"/>
                            <input id="archivedFileurl" name="archivedFileurl" type="hidden"  value="${requestScope.poHead.archivedFileurl}">
                            <span style="color:#2972FA;font-size:14px;position:relative;top:1px;opacity:0.8; ">上传文件不能超过10M</span>
                        </div>--%>
                    </div>
                    <div id="showFile1" style="margin-left:136px;"></div>
                </div>
            </div>
            <div class="trackSubmit">
                <a id="cancel" class="cancelBtn" onclick="window.location.href='web/poAgreementHeadArchived/poaArchivedList'">取消</a>
            </div>
        </div>
        </form>
    </div>
</div>
</body>
<script src="css/bootstrap-3.3.7/js/address.js" type="text/javascript" charset="utf-8"></script>
<script>
    $(document).ready(function() {
        document.getElementById("myFieldset").disabled=true;
        //初始化合同性质
        if("${requestScope.poHead.taxType}"!=""){
            $("#taxType").val("${requestScope.poHead.taxType}");
        }
        //初始化是否为据实结算
        if("${requestScope.poHead.isRealSettle}"=="是"){
            $('#isRealSettle').attr("checked","checked");
        }
        //初始化合同类别
        if("${requestScope.poHead.taxPercent}"!=""){
            $("#taxPercent").val("${requestScope.poHead.taxPercent}");
        }
        //初始化合同类型
        if("${requestScope.poHead.poType}"!=""){
            $("#poType").val("${requestScope.poHead.poType}");
        }
        //初始化结算方式
        if("${requestScope.poHead.settleStyle}"!=""){
            $("#settleStyle").val("${requestScope.poHead.settleStyle}");
        }
        //初始化合同来源方式
        if("${requestScope.poHead.sourceMode}"!=""){
            $("#sourceMode").val("${requestScope.poHead.sourceMode}");
        }
        //初始化合同类型
        if("${requestScope.poHead.poType}"!=""){
            $("#poType").val("${requestScope.poHead.poType}");
        }
        //初始化合同附件
        if("${requestScope.poHead.fileUrl}"!=""){
            var urls="${requestScope.poHead.fileUrl}".split(",");
            var html = "";
            for (var i = 0; i <urls.length; i++) {
                if(urls[i]!=""){
                    html+="<a href='"+urls[i]+"'>"+urls[i].substr(urls[i].lastIndexOf("/") + 1)+"</a>\n"
                }
            }
            $("#showFile").html(html);
        }
        //初始化相关附件
        if("${requestScope.poHead.archivedFileurl}"!=""){
            var urls="${requestScope.poHead.archivedFileurl}".split(",");
            var html = "";
            for (var i = 0; i <urls.length; i++) {
                if(urls[i]!=""){
                    html+="<a href='"+urls[i]+"'>"+urls[i].substr(urls[i].lastIndexOf("/") + 1)+"</a>\n"
                }
            }
            $("#showFile1").html(html);
        }


        //初始化供应商信息
        if("${requestScope.poHead.staffCode}"!=""){
            $("#staffCode").val("${requestScope.poHead.staffCode}");
            funcVendorSelect();
        }
        //初始化合同金额及是否据实结算
        funcPoTypeChange();
    });

    //合同类型值变
    function funcPoTypeChange(){
        var poTypevalue = $('#poType').val();
        if(poTypevalue=='POATYPE01'){//固定价款
            $('#isRealSettle').removeAttr("checked");
            $('#isRealSettle').attr("disabled","disabled");
            $('#poaAmount').removeAttr('readonly');
        }
        if(poTypevalue=='POATYPE02'){//据实结算
            $('#isRealSettle').attr("checked","checked");
            $('#isRealSettle').attr("disabled","disabled");
            $('#poaAmount').attr("readonly","readonly");
        }
    }

    //为外面的盒子绑定一个点击事件
    $("#uploadImgBtn1").click(function(e){
        imagesUpload(e);
    })

    function imagesUpload(e){
        var cid=e.currentTarget.id;
        var s=cid.substr(cid.length-1,1);
        /*
        1、先获取input标签
        2、给input标签绑定change事件
        3、把图片回显
         */
        //1、先回去input标签
        var $input = $("#file"+s+"");
        //2、给input标签绑定change事件
        $input.on("change" , function(){
            //补充说明：因为我们给input标签设置multiple属性，因此一次可以上传多个文件
            //获取选择图片的个数
            var files = this.files;
            // 通过FormData将文件转成二进制数据
            // 文件元素
            var file = document.querySelector('[type=file]');
            // 通过FormData将文件转成二进制数据
            var formData = new FormData();
            for(var i = 0;i<files.length;i++){
                formData.append("imgs", files[i]);
            }
            var ss=formData.get("fileImage[]");
            $.ajax({
                type: "post",
                url:  "web/poAgreementHead/file",
                data: formData,
                dataType: "json",
                processData: false, // 告诉jQuery不要去处理发送的数据
                contentType: false, // 告诉jQuery不要去设置Content-Type请求头
                xhrFields:{withCredentials:true},
                async: true,    //默认是true：异步，false：同步。
                success: function (data) {
                    if(data!=""){
                        var url="";
                        var html = "";
                        for (var i=0;i<data.length;i++){
                            url+=data[i]+",";
                            html+="<a href='"+data[i]+"'>"+data[i].substr(data[i].lastIndexOf("/") + 1)+"</a>\n"
                        }
                        $("#archivedFileurl").val(url);
                        $("#showFile1").html(html);
                    }

                },
                error: function(XMLHttpRequest, textStatus, errorThrown){
                    redragonJS.alert(textStatus);
                },
            });
        })
    }

    function toDoSubmit(){
        $('#form').submit();
    }

    //供应商下拉选中，加载信息
    function funcVendorSelect(){
        $.ajax({
            type: "post",
            url: "web/poAgreementHead/getMdVendor",
            data: {"vendorId": $("#staffCode").val()},
            async: true,
            dataType: "json",
            cache: false,
            success: function(data){
                $('#vendorAddress').val(data.vendorAddress);
                $.each(pdata,function(idx,item){
                    if (parseInt(item.level) == 0) {
                        if(item.code==data.vendorProvince){
                            $('#vendorProvince').val(item.names);
                        }
                    }
                    if (parseInt(item.level) == 1) {
                        if(item.code==data.vendorCity){
                            $('#vendorCity').val(item.names);
                        }
                    }
                });
                $('#staffName').val(data.vendorName);
                $('#contactName').val(data.contactName);
                $('#contactTelephone').val(data.contactTelephone);
                $('#bankCode').val(data.bankCode);
                $('#bankAccount').val(data.bankAccount);


            },
            error: function(XMLHttpRequest, textStatus, errorThrown){
                redragonJS.alert(textStatus);
            }
        });
    }

    /**付款情况js   begin**/
    getPoAgreementHeadMList();
    //查询支付情况信息
    function getPoAgreementHeadMList(){
        $.ajax({
            type: "post",
            url: "web/poAgreementHead/getPoAgreementHeadMList",
            data: {"poHeadCode": $("#poHeadCode").val()},
            async: true,
            cache: false,
            success: function(data){
                $('#subBody tr').each(function(i){
                    if(/\w*.?line\w*.?/.test($(this).attr('id'))){
                        $(this).remove();
                    }
                });
                var html = "";
                if(data != null && data.length>0){
                    for(var i=0;i<data.length;i++){
                        var subSize = (i+1);
                        html += '<tr id="line' + subSize + '">' +
                            '<td id="No' + subSize + '">' + subSize + '</td>' +
                            '<td id="subId' + subSize + '" style="display: none">'+data[i].id+'</td>' +
                            '<td id="subPaymentBatch' + subSize + '">' + data[i].paymentBatch+ '</td>' +
                            '<td id="subAmountPayable' + subSize + '">' + data[i].amountPayable + '</td>' +
                            '<td id="subPaymentProportion' + subSize + '">' + data[i].paymentProportion + '</td>' +
                            '<td id="subRemainingAmount' + subSize + '">' + data[i].remainingAmount + '</td>' +
                            '<td id="subPayDate' + subSize + '">' + data[i].payDate + '</td>' +
                            '<td id="subRemark' + subSize + '"></td>' +
                            '</tr>'
                    }
                    $("#subBody").append(html);
                }else{
                    html += '<tr id="nothing">' +
                        '<td colspan="8" style="color: #bbbbbb">无付款信息</td>' +
                        '</tr>'
                    $("#subBody").append(html);
                }
            }
            ,
            error: function(XMLHttpRequest, textStatus, errorThrown){
                redragonJS.alert(textStatus);
            }
        });
    }

    /**付款情况js   end**/
</script>


</html>
